import React, { useCallback, useRef, useState } from "react";
import { Button, Modal } from "antd"; // 假设您使用的是Ant Design库

var handleOk = () => {};
var handleCancel = () => {};
const YourComponent = () => {
  const [isModalOpen, setIsModalOpen] = useState(false);

  const deleteSome = (id) => {
    const modal = Modal.confirm();

    
    // setIsModalOpen(true);
    return new Promise((resolve, reject) => {
      console.log("id", id);

      modal.update({
        title: '修改的标题',
        content: '修改的内容',
        onOk:() => {
          console.log("带着ID进行了删除的操作！！！", id);
          // setIsModalOpen(false);
          resolve();
        },
        onCancel: () => {
          console.log("点击进行了取消操作~");
          // setIsModalOpen(false);
          resolve()
        }
      });
      // handleOk = () => {
      //   console.log("带着ID进行了删除的操作！！！", id);
      //   // setIsModalOpen(false);
      //   resolve();
      // };
      // handleCancel = () => {
      //   console.log("点击进行了取消操作~");
      //   // setIsModalOpen(false);
      //   resolve()
      // };
    });
  };

  console.log(handleOk.toString());
  

  return (
    <>
      <Button type="primary" onClick={() => deleteSome(1)}>
        Open Modal
      </Button>
      {/* <Modal
        title="Basic Modal"
        open={isModalOpen}
        onOk={handleOk}
        onCancel={handleCancel}
      >
        <p>Some contents...</p>
        <p>Some contents...</p>
        <p>Some contents...</p>
      </Modal> */}
    </>
  );
};

export default YourComponent;
